<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 800px;
        display: grid;
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: 45px 200px;
        grid-column-gap: 5px;
      }
      .option {
        border: 1px solid #cbcbcc;
        transform: translateY(1px);
        display: grid;
        justify-content: center;
        align-content: center;
        color: #00e;
        cursor: pointer;
      }
      .container {
        border: 1px solid #cbcbcc;
        grid-area: 2/1/3/11;
        display: grid;
        justify-content: center;
        align-items: center;
      }
      .first {
        border-bottom: 1px solid #fff;
      }
      .small {
        width: 700px;
        display: grid;
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: 45px 70px;
        justify-content: center;
      }
      .option2 {
        border: 1px solid #cbcbcc;
        background-color: #f1f1f1;
        display: grid;
        justify-content: center;
        align-content: center;
        color: #00e;
        transform: translateY(1px);
      }
      .start {
        grid-column-start: 4;
      }
      .container2 {
        border: 1px solid #cbcbcc;
        grid-area: 2/1/3/11;
        display: grid;
        justify-content: center;
        align-content: center;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="option first">电器</div>
      <div class="option">数码</div>
      <div class="option">家居</div>
      <div class="option">男装</div>
      <div class="container">
        <div class="small">
          <div class="option2 start">床具</div>
          <div class="option2">桌具</div>
          <div class="option2">摆件</div>
          <div class="option2">厨具</div>
          <div class="container2"></div>
        </div>
      </div>
    </div>

    <script>
      let option = document.querySelectorAll(".option");
      let option2 = document.querySelectorAll(".option2");
      let container = document.querySelector(".container");
      let container2 = document.querySelector(".container2");
      let optionArr = [...option];
      let optionArr2 = [...option2];
      let big = [
        ["电视", "电脑", "冰箱", "洗衣机"],
        ["相机", "平板", "手机", "电子书"],
        ["床具", "桌具", "摆件", "厨具"],
        ["上衣", "裤子", "外套", "鞋子"],
      ];
      optionArr.forEach((item, index) => {
        item.onmouseenter = function () {
          optionArr.forEach((value) => {
            value.style.borderBottom = "1px solid #CBCBCC";
          });
          item.style.borderBottom = "1px solid #fff";
          optionArr2.forEach((c, i) => {
            c.innerHTML = big[index][i];
            container2.innerHTML = `${big[index][0]}内容1`;
          });
        };
      });
      optionArr2.forEach((item, index) => {
        
        item.onmouseenter = function () {
          optionArr2.forEach((value) => {
            value.style.borderBottom = "1px solid #CBCBCC";
            value.style.backgroundColor = "#F1F1F1";
          });
          container2.innerHTML = `${item.innerHTML}内容${index + 1}`;
          item.style.borderBottom = "1px solid #fff";
          item.style.backgroundColor = "#fff";
        };
      });
    </script>
  </body>
</html>
